#include "welcome.h"
#include "ui_welcome.h"
#include "../core/preference.h"
#include "mainwindow.h"
#include <QFileDialog>

Welcome::Welcome(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Welcome)
{
    ui->setupUi(this);
}

Welcome::~Welcome()
{
    delete ui;
}

void Welcome::on_pushButton_clicked()
{
    Preference *pref = Preference::getInstance();
    QFileDialog dialog(this);
    dialog.setFileMode(QFileDialog::Directory);
    dialog.setWindowTitle("Select librairy");
    if(dialog.exec())
    {
        pref->addLibrairy(dialog.selectedFiles());
        emit librairyAdded();
    }
}
